package com.ganzalang.gmall.gmallfreemarker.demo.db;

import com.ganzalang.gmall.gmallfreemarker.api.dto.ProductDTO;
import com.ganzalang.gmall.gmallfreemarker.demo.entity.UserDemoEntity;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class ProductDb {

    private static List<ProductDTO> products = new ArrayList<>();
    public static final String USERNAME = "ganzalang";
    public static final String PASSWORD = "123";
    public static final Long PRIMARY_KEY_ID = 1001L;
    static {
        for (int i = 0; i < 10; i++) {
            ProductDTO p = new ProductDTO();
            p.setId(PRIMARY_KEY_ID + i);
            p.setName("IPhone " + (i+1));
            String imgUrl = i % 2 == 0 ? "https://gd3.alicdn.com/imgextra/i3/2465247815/O1CN01T5aJvi27bK6izPvgC_!!2465247815.jpg" :
                    "https://gd3.alicdn.com/imgextra/i3/2465247815/O1CN01VmkUcJ27bK6lbvCld_!!2465247815.jpg";
            p.setImgUrl(imgUrl);
            products.add(p);
        }
    }
    public static List<ProductDTO> listProducts() {
        return products;
    }


}
